﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio.Office
{
    public interface IOfficer
    {
        /// <summary>
        /// 读取列名数据集合
        /// </summary>
        /// <param name="argFilePathName">文件全路径</param>
        /// <param name="argIsIdenticalSheet">是否是相同Process的Recipe</param>
        /// <returns>返回读取CSV数据列名集合</returns>
        Task<ResultList<OfficeFileDataReadColumn>> ReadDataTableColumns(string argFilePathName, bool argIsIdenticalSheet = false);
        /// <summary>
        /// 读取列名和列值数据[文件到DataTable]
        /// </summary>
        /// <param name="argFilePathName">文件全路径</param>
        /// <param name="argIsExistsColumns">是否存在头部列名行数据</param>
        /// <param name="argIsIdenticalSheet">是否是相同Process的Recipe</param>
        /// <returns>返回读取文件数据的DataTable</returns>
        Task<ResultList<OfficeFileDataReadTable>> ReadDataTable(string argFilePathName, bool argIsExistsColumns = true, bool argIsIdenticalSheet = false);

        /// <summary>
        /// 写入列名和列值数据[多个相同表结构DataTable到CSV文件]
        /// </summary>
        /// <param name="argFilePathName">文件路径及csv文件名称</param>
        /// <param name="argDataTableList">数据表集合</param>
        /// <returns>true-保存成功，false-保存失败</returns>
        Task<Result> WriteDataTableHead(string argFilePathName, List<DataTable> argDataTableList);
        /// <summary>
        /// 写入列名和列值数据[单DataTable到文件]
        /// </summary>
        /// <param name="argFilePathName">文件路径及文件名称</param>
        /// <param name="argDataTable">数据表</param>
        /// <param name="argIsCreateFile">是否创建文件</param>
        /// <param name="argIsCreateColumns">是否创建数据列名</param>
        /// <returns>true-保存成功，false-保存失败</returns>
        Task<Result> WriteDataTableHead(string argFilePathName, DataTable argDataTable, bool argIsCreateFile = true, bool argIsCreateColumns = true);
        /// <summary>
        /// 写入列名和列值数据[多个行数据到文件]
        /// </summary>
        /// <param name="argFilePathName">文件路径及文件名称</param>
        /// <param name="argDataModelList">数据模型对象集合</param>
        /// <returns>true-保存成功，false-保存失败</returns>
        Task<Result> WriteDataModelHead(string argFilePathName, List<string> argDataModelList, bool argIsCreateFile = true);
        /// <summary>
        /// 写入列名和列值数据[多个行数据到文件]
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="argFilePathName">文件路径及文件名称</param>
        /// <param name="argDataModelList">数据模型对象集合</param>
        /// <param name="argIsCreateFile">是否创建文件</param>
        /// <param name="argIsCreatePropertys">是否创建属性字段名称</param>
        /// <param name="argIsTypeName">是否创建类名称</param>
        /// <returns></returns>
        Task<Result> WriteDataModelHead<T>(string argFilePathName, List<T> argDataModelList, bool argIsCreateFile = true, bool argIsCreatePropertys = true, bool argIsTypeName = false) where T : class, new();
    }
}
